﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using SmartCity.Shared;
using Volo.Abp.Domain.Entities;

namespace CommonManagement
{
    /// <summary>
    /// 新闻资讯类
    /// </summary>
    public class Press : BasicAggregateRoot<int>
    {
        /// <summary>应用类型</summary>
        public string AppType { get; protected set; }

        /// <summary>类型Id</summary>
        public int Type { get; protected set; }

        /// <summary>封面图片地址</summary>
        public string Cover { get; protected set; }

        /// <summary>标题</summary>
        public string Title { get; protected set; }

        /// <summary>副标题</summary>
        public string SubTitle { get; protected set; }

        /// <summary>内容</summary>
        public string Content { get; protected set; }

        /// <summary>标签</summary>
        public string Tags { get; protected set; }

        /// <summary>评论数</summary>
        [NotMapped]
        public int CommentNum { get; set; }

        /// <summary>点赞数</summary>
        public int LikeNum { get; protected set; }

        /// <summary>阅读数</summary>
        public int ReadNum { get; protected set; }

        /// <summary>推荐</summary>
        public SystemWhether Top { get; protected set; }

        /// <summary>热点</summary>
        public SystemWhether Hot { get; protected set; }

        /// <summary>状态</summary>
        public SystemWhether Status { get; protected set; }

        /// <summary>发布日期</summary>
        public DateTime PublishDate { get; protected set; }

        /// <summary>分类</summary>
        [ForeignKey("Type")]
        public Category Category { get; protected set; }

        /// <summary>评论集合</summary>
        public IList<Comment> Comments { get; protected set; }

        private Press() { }

        /// <summary>
        /// 阅读
        /// </summary>
        public Press Read()
        {
            this.ReadNum++;
            return this;
        }

        /// <summary>
        /// 点赞
        /// </summary>
        public Press Like()
        {
            this.LikeNum++;
            return this;
        }
    }
}